package oop6;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Divide3 {

	public static void main(String[] args) {
		// 两数相除
		Scanner in = new Scanner(System.in);
		try {
			System.out.println("输入被除数：");
			int a = in.nextInt();
			System.out.println("输入除数:");
			int b = in.nextInt();
			int shang = a / b;
			System.out.println(a + "/" + b + "=" + shang);
			// instanceof
		} catch (InputMismatchException e) {
			System.out.println("输入错误！");
			e.printStackTrace();// 原因

		} catch (ArithmeticException e) {
			System.out.println("除数不能是0");
			e.printStackTrace();
		} finally {
			System.out.println("谢谢使用！");
		}
		System.out.println("除法计算结束了");
	}

}
